package com.maple.utils.db

import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
import com.maple.provider.ContextProvider
import com.maple.utils.const.UtilsInit

@Database(entities = [User::class], version = 1 , exportSchema = false)
public abstract class AppDataBase: RoomDatabase(){

    abstract fun getUserDao(): UserDao

    companion object {
        private const val DB_NAME = "com.maple.app.db"

        val instance = Single.instance
    }

    private object Single {
        val instance : AppDataBase = Room.databaseBuilder(
//            UtilsInit.instance,
            ContextProvider.appContext,
            AppDataBase::class.java,
            DB_NAME
        )
            .allowMainThreadQueries()
            .build()
    }



}